/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.converter;

import br.com.deployment.entities.Category;
import br.com.deployment.entities.Questionnaire;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author ely
 */
@FacesConverter(value="questionnaireConverter")
public class QuestionnaireConverter implements Converter{
    
    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        Questionnaire tipo = new Questionnaire();
        tipo.setId((Long.valueOf(value))); 
        return tipo;
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        Questionnaire tipo = (Questionnaire) value;
        return ""+tipo.getId();
    }
    
}
